#include<iostream>
using namespace std;
bool Prime(int n)
{
	if (n < 2) {
		return 0;
	}
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			return 0;
		}
	}
	return 1;
}
int main()
{
	int n;
	cin >> n;
	if (Prime(n)&&(Prime(n-6)||Prime(n+6))) {
		cout << "Yes" << endl;
		if (Prime(n - 6)) {
			cout << n - 6 << endl;
		}
		else {
			cout << n + 6 << endl;
		}
	}
	else {
		cout << "No" << endl;
		for (int i = n + 1;; i++) {
			if (Prime(i) && (Prime(i + 6) || Prime(i - 6))) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}